package com.ttg.data;

//~--- non-JDK imports --------------------------------------------------------

import com.ttg.config.Properties;
import com.ttg.contants.KeyContants;
import com.ttg.pojo.*;
import com.ttg.security.SecurityKit;
import com.ttg.utils.HttpKit;
import com.ttg.utils.IdUtils;
import com.ttg.utils.MD5;

//~--- classes ----------------------------------------------------------------

/**
 * Class InitGatewayReqData
 * Description 说明：
 * Create 2016-08-09 11:50:27
 * @author Ardy
 */
public class InitGatewayReqData {

    /**
     * Method initOpenAccountReq
     * Description 说明：开户接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static OpenAccountReqDTO initOpenAccountReq() {
        OpenAccountReqDTO openAccountReq = new OpenAccountReqDTO();

        openAccountReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        openAccountReq.setMerOrderId(IdUtils.genOrdId16());
        openAccountReq.setMerOrderId(String.valueOf(IdUtils.genItemId()));
        openAccountReq.setCustId(MD5.md5T16());
        openAccountReq.setCustomerName("张三");
        openAccountReq.setCustIdType("0");
        openAccountReq.setCustPhone("12345678901");
        openAccountReq.setCustomerType(KeyContants.SELLER);
        openAccountReq.setSubMerName("测试商户的子商户1");
        openAccountReq.setAccountCardType(KeyContants.VCAD);
        openAccountReq.setSignatureAlgorithm(KeyContants.SECURITY_TYPE);
        openAccountReq.setSignatureInfo(
            SecurityKit.signByRSA(HttpKit.httpGwParam2SignStr(openAccountReq.getAllParameters())));

        return openAccountReq;
    }

    /**
     * Method initPaymentReq
     * Description 说明：支付接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static PaymentReqDTO initPaymentReq() {
        PaymentReqDTO paymentReq = new PaymentReqDTO();

        paymentReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        paymentReq.setCurrency(KeyContants.CURRENCY);
        paymentReq.setDetail("这是一笔测试支付订单");
        paymentReq.setSubject("测试支付");
        paymentReq.setMerOrderId(MD5.md5T16());
        paymentReq.setUserId("zhangsan");
        paymentReq.setMediPwdCheck(0);
        paymentReq.setImmediatelyPay(0);
        paymentReq.setFeeAmt(0);
        paymentReq.setTransAmt(1);
        paymentReq.setBgRetUrl("http://origin.imwork.net/gateway-demo" + Properties.URL.getString("BG_PAY_CALLBACK_URL"));
        paymentReq.setPgRetUrl("http://origin.imwork.net/gateway-demo" + Properties.URL.getString("PG_CALLBACK_URL"));


        return paymentReq;
    }

    /**
     * Method initQueryOrderReq
     * Description 说明：查询订单接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static QueryOrderReqDTO initQueryOrderReq() {
        QueryOrderReqDTO queryOrderReq = new QueryOrderReqDTO();

        queryOrderReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        queryOrderReq.setMerOrderId(MD5.md5T16());
        queryOrderReq.setOriMerOrderId(Properties.TEST.getString("MER_ORDER_ID"));
        queryOrderReq.setOriTransDate("20160809");

        return queryOrderReq;
    }

    /**
     * Method initTakeOverGoodsReq
     * Description 说明：确认收货接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static TakeOverGoodsReqDTO initTakeOverGoodsReq() {
        TakeOverGoodsReqDTO takeOverGoodsReq = new TakeOverGoodsReqDTO();

        takeOverGoodsReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        takeOverGoodsReq.setMerOrderId(MD5.md5T16());
        takeOverGoodsReq.setSellerMediId("6231460500000000015");
        takeOverGoodsReq.setBuyerMediId("");
        takeOverGoodsReq.setMediPwdCheck(0);

        return takeOverGoodsReq;
    }

    /**
     * Method initRefundGoods
     * Description 说明：退货接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static RefundGoodsReqDTO initRefundGoods() {
        RefundGoodsReqDTO refundGoodsReqDTO = new RefundGoodsReqDTO();

        refundGoodsReqDTO.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        refundGoodsReqDTO.setMerOrderId(MD5.md5T16());
        refundGoodsReqDTO.setCurrency(KeyContants.CURRENCY);
        refundGoodsReqDTO.setBgRetUrl("http://origin.imwork.net/gateway-demo" + Properties.URL.getString("BG_REFUND_CALLBACK_URL"));

        return refundGoodsReqDTO;
    }

    /**
     * Method initWithdrawal
     * Description 说明：提现接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static WithdrawalReqDTO initWithdrawal() {
        WithdrawalReqDTO withdrawalReqDTO = new WithdrawalReqDTO();

        withdrawalReqDTO.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        withdrawalReqDTO.setMerOrderId(MD5.md5T16());
        withdrawalReqDTO.setTransAmt(100);
        withdrawalReqDTO.setDrCrFlag("CR");
        withdrawalReqDTO.setCounterpartMediId("6231467272738292388");
        withdrawalReqDTO.setThirdtyp("INNERACCT");
        withdrawalReqDTO.setUsrName("郭骏");
        withdrawalReqDTO.setOpenBank("九江银行");
        withdrawalReqDTO.setProv("江西");
        withdrawalReqDTO.setCity("九江");
        withdrawalReqDTO.setProv("测试提现");
        withdrawalReqDTO.setFeeDirection("CHARGE");
        withdrawalReqDTO.setSubBank("九江分行");
        withdrawalReqDTO.setPurpose("测试提现");


        return withdrawalReqDTO;
    }

    /**
     * Method initQueryBalance
     * Description 说明：查询余额接口请求数据准备
     *
     * @return 返回值说明：
     */
    public static QueryAccountBalanceReqDTO initQueryBalance() {
        QueryAccountBalanceReqDTO queryAccountBalanceReq = new QueryAccountBalanceReqDTO();

        queryAccountBalanceReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        queryAccountBalanceReq.setMerOrderId(MD5.md5T16());
        queryAccountBalanceReq.setSignatureAlgorithm(KeyContants.SECURITY_TYPE);
        queryAccountBalanceReq.setSignatureInfo(
            SecurityKit.signByRSA(HttpKit.httpGwParam2SignStr(queryAccountBalanceReq.getAllParameters())));

        return queryAccountBalanceReq;
    }

    public static AppPayReqDTO initAppPayReq() {
        AppPayReqDTO appPayReq = new AppPayReqDTO();

        appPayReq.setMerchantId(Properties.TEST.getString("MERCHANT_ID"));
        appPayReq.setCurrency(KeyContants.CURRENCY);
        appPayReq.setDetail("这是一笔测试支付订单");
        appPayReq.setSubject("测试支付");
        appPayReq.setMerOrderId(MD5.md5T16());
        appPayReq.setFeeAmt(0);
        appPayReq.setTransAmt(1);
        appPayReq.setBgRetUrl("http://origin.imwork.net/gateway-demo" + Properties.URL.getString("BG_PAY_CALLBACK_URL"));
        appPayReq.setPgRetUrl("http://origin.imwork.net/gateway-demo" + Properties.URL.getString("PG_CALLBACK_URL"));


        return appPayReq;

    }
}


//~ Formatted by Jindent --- http://www.jindent.com
